package com.bbz.core.lambda;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class MainTest {
    public static void main(String args[]) {
        SuperPNR superpnr = new SuperPNR();

        ModularProduct mp = new ModularProduct();
        mp.setProductId("123123");
        List<ModularProduct> list = new ArrayList<>();
        list.add(mp);

        superpnr.setModularProducts(list);

        List<ModularProduct> list1 = copySuper(superpnr);

        test(superpnr, list1);

        System.out.println(superpnr.getModularProducts().get(0).getProductId());

    }

    public static void test(SuperPNR superPNR, List<ModularProduct> list1) {
        ModularProduct modularProduct=new ModularProduct();
        modularProduct=list1.get(0);
        modularProduct.setProductId("11111");
    }

    public static List copySuper(SuperPNR superPNR) {
        List<ModularProduct> list=new ArrayList<>();
        for(ModularProduct mp:superPNR.getModularProducts()){
            list.add(mp);
        }
        return list;
    }
}
